﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using CRM.Entity;
using CRM.BLL;
using DP.Web.UI;
using DP.Common;


namespace CRM.Web.MessagingManage
{
    public partial class SMSShow : Common.PageBase
    {
        private T_SMS_SEND_BLL smsSendBll = new T_SMS_SEND_BLL();
        private T_SMS_SENT_BLL smsSentBll = new T_SMS_SENT_BLL();
        private T_SMS_RECV_BLL smsRecvBll = new T_SMS_RECV_BLL();

        protected override void OnInit(EventArgs e)
        {
            base.VerificationRight = false;
            base.OnInit(e);
            PageHelper.SetPrePageUrl(this.Page);
            PageHelper.SetGoBackUrl(this.Page, btnCancel, StaticConstant.NotBackUrl);

        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                pageDataInit();
            }
        }

        #region 页面初始化数据绑定




        #endregion

        private void pageDataInit()
        {
            String SMSType = PageHelper.GetQueryString(this.Page, "SMSType");
            string AutoId = PageHelper.GetQueryString(this.Page, "AUTOID");
            switch (SMSType)
            {
                case"SEND":
                    {
                        T_SMS_SEND_Entity smsSendEntity = smsSendBll.GetEntity("AUTOID", AutoId);
                        if (smsSendEntity != null)
                        {
                            txtBODYS.Text = smsSendEntity.BODYS;
                            txtSUBJECTS.Text = smsSendEntity.SUBJECTS;
                            lblTEL_TO.Text = smsSendEntity.TEL_TO;
                            txtUNAME.Text = smsSendEntity.UNAME;
                        }

                    }
                    break;
                case "SENT":
                    {
                        T_SMS_SENT_Entity smsSentEntity = smsSentBll.GetEntity("AUTOID", AutoId);
                        if (smsSentEntity != null)
                        {
                            txtBODYS.Text = smsSentEntity.BODYS;
                            txtSUBJECTS.Text = smsSentEntity.SUBJECTS;
                            lblTEL_TO.Text = smsSentEntity.TEL_TO;
                            txtUNAME.Text = smsSentEntity.UNAME;
                        }
                    }
                    break;
                case "RECEIVE":
                    {
                        T_SMS_RECV_Entity smsRecvEntity = smsRecvBll.GetEntity("AUTOID", AutoId);
                        if (smsRecvEntity != null)
                        {
                            txtBODYS.Text = smsRecvEntity.BODYS;
                            txtSUBJECTS.Text = smsRecvEntity.SUBJECTS;
                            lblTEL_TO.Text = smsRecvEntity.TEL_FROM;
                            txtUNAME.Text = smsRecvEntity.UNAME;
                        }
                    }
                    break;
            }


        }
    }
}
